﻿

@{
    ViewData["Title"] = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@using DH.Core.Helper

@using Microsoft.AspNetCore.Mvc.Localization
@inject IHtmlLocalizer<SharedResources> SharedLocalizer

<div id="appModel" style="text-align: center;">

    <div style="width:99.5%;display: inline-block;text-align: left;">

        <!--多行条件-->
        @*<div class="topPanel">
                <div class="search">
                    <table>
                        <tr>
                            <td>
                                <div class="input-group">
                                    <input id="txt_keyword" type="text" class="form-control" placeholder="@SharedLocalizer["KeyPlaceHolder"]" style="width: 260px;" v-model="queryKey">

                                    <span class="input-group-btn">
                                        <button id="btn_search" type="button" class="btn  btn-primary-blue" v-on:click="search"><i class="fa fa-search"></i></button>
                                    </span>


                                </div>
                            </td>
                        </tr>
                    </table>
                </div>
            </div>*@

        <!--单行条件-->
        @*<div class="panel panel-default">
            <div class="panel-heading">查询条件</div>
            <div class="panel-body">
                <div class="input-group">
                    <input id="txt_keyword" type="text" class="form-control" placeholder="@SharedLocalizer["KeyPlaceHolder"]" style="width: 260px;" v-model="queryKey">
                    <span class="input-group-btn">
                        <button id="btn_search" type="button" class="btn  btn-primary-blue" v-on:click="search"><i class="fa fa-search"></i>查询</button>
                    </span>


                </div>
            </div>

        </div>*@

        <div id="toolbar">
            <div class="btn-group">
                @*<a class="btn btn-default" onclick="$dh.reload()"><span class="glyphicon glyphicon-refresh"></span></a>
                <button class="btn btn-default" v-bind:disabled="!selectedData" v-on:click="edit"><i class="fa fa-pencil-square-o"></i>@SharedLocalizer["Update"]</button>
                <button class="btn btn-default" v-bind:disabled="!selectedData" v-on:click="del"><i class="fa fa-trash-o"></i>@SharedLocalizer["Delete"]</button>
                <button class="btn btn-default" v-on:click="add"><i class="fa fa-plus"></i>@SharedLocalizer["Add"]</button>*@


                
                @await Html.PartialAsync("_Partical_Button")
                <!--开发者才有的权限-->
                @*@{
                    var isDevelpoer = this.ViewBag.CurrentUser.IsDeveloper;
                    if (isDevelpoer)
                    {
                        <button class="btn btn-default" onclick="_vmBase.InitResource();"><i class="fa fa-upload"></i>@SharedLocalizer["InitResource"]</button>
                    }
                }*@
            </div>

        </div>

        <div class="table-responsive" style="width:100%">
            <table class="table table-no-bordered " id="tb_categories"></table>
        </div>

        <modal-dialog v-show="showDialog" :title="modalTitle" :entity="entityObj" :btnclose="btnClose" :btnsubmit="btnSubmit">
            <div slot="modal-body">

                <form id="form1">
                    <div style="margin-top: 10px; margin-left: 10px; margin-right: 10px;">
                        <div style=" margin-right: 30px;">
                            <table class="form">

                                <tr>
                                    <td class="formTitle">名称</td>
                                    <td class="formValue">
                                        <input id="name" name="name" type="text" class="form-control required" placeholder="请输入名称" v-model="entityObj.Name" />
                                    </td>

                                </tr>
                                <tr>
                                    <td class="formTitle">类型</td>
                                    <td class="formValue">
                                        <select id="categoryCode" name="categoryCode" class="form-control required" v-model="entityObj.CategoryCode">
                                            <option value="@ConstHelper.CategoryResourceType">资源</option>
                                            <option value="@ConstHelper.CategoryDicType">字典</option>
                                            
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="formTitle">父编码</td>
                                    <td class="formValue">
                                        @*<select id="parentCode" name="parentCode" class="form-control" v-model="entityObj.ParentCode">
                                        </select>*@

                                        <input type="text" id="ParentName" name="ParentName" v-model="entityObj.ParentName" style="height:30px;" class="form-control required" />
                                        <input type="hidden" id="ParentCode" name="ParentCode" v-model="entityObj.ParentCode" />
                                        <div id="menuContent" class="menuContent" style="display: none;">
                                            <ul id="parentDicTree" class="ztree"></ul>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="formTitle">编码</td>
                                    <td class="formValue">
                                        <input id="code" name="code" type="text" class="form-control required" placeholder="请输入编码" v-model="entityObj.Code" />
                                    </td>

                                </tr>
                                <tr>
                                    <td class="formTitle">状态</td>
                                    <td class="formValue">
                                        <input type="radio" id="one" value="true" v-model="entityObj.Status">
                                        <label for="one">启用</label>
                                        <input type="radio" id="two" value="false" v-model="entityObj.Status">
                                        <label for="two">禁用</label>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="formTitle">描述</td>
                                    <td class="formValue">
                                        <input id="description" name="description" type="text" class="form-control" placeholder="请输入描述" v-model="entityObj.Description" />
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </form>
            </div>

        </modal-dialog>
    </div>

</div>
<!--启用 filter 功能-->
<link href="~/lib/bootstrap-table/src/extensions/filter-control/bootstrap-table-filter-control.css" rel="stylesheet" />
<script src="~/lib/bootstrap-table/src/extensions/filter-control/bootstrap-table-filter-control.js"></script>

@this.RefScript("~/content/js/base.js")
<script type="text/javascript">

    var _getTableListUrl = "@this.Href("~/Category/Categories")";
    var _updateModelUrl = "@this.Href("~/Category/Add")";
    var _deleteModelUrl = "@this.Href("~/Category/Delete")";
    var _initResource = "@this.Href("~/Category/InitResource")";
    var _getDicsUrl = "@this.Href("~/Category/GetDics")";
    var _enabledResourceUrl = "@this.Href("~/Category/EnableResource")";
    var _disabledResourceUrl = "@this.Href("~/Category/DisableResource")";
    var _getDicTreeUrl = "@this.Href("~/Category/GetDicTree")";
    var _getDicDefaultTreeUrl = "@this.Href("~/Category/GetDicDefaultTree")";

    

    //categoryhCode 默认为字典
    var defaultCategoryCode = "@ConstHelper.CategoryResourceType";
    var categoryDicType = "@ConstHelper.CategoryDicType";
    var categoryResourceType = "@ConstHelper.CategoryResourceType";


    var _parentDicTree;

    var _InitResourceStr = '@SharedLocalizer["InitResource"]';

</script>
<script src="~/js/Views/Category/Index.js"></script>
